<template>
    <div id="tmpl">
           <div class="title">
                <h4 v-text="info.title"></h4>
                <p v-text="info.add_time"></p>
           </div>
            <div class="content">{{info.id}}</div>
           <div class="content" v-html="info.content"></div>

            <!--使用导入的组件-->
           <comment :id="id"></comment>
    </div>
</template>

<script>
//导入公共 组件工具
import con from '../../kits/common.js'

//导入comment评论组件
import comment from '../subcom/comment.vue';

import {Toast} from 'mint-ui';
    export default {
        components:{
            comment
        },
        data(){
            return {
                id:0,
                info:{
						//   "id": 13,
						//   "title": "1季度多家房企利润跌幅超50% 去库存促销战打响",
						//   "add_time": "2015-04-16T03:50:28.000Z",
						//   "zhaiyao": "房企一季度销售业绩已经陆续公布，克而瑞研究中心统计",
						//   "click": 1,
						//   "img_url": "http://www.webhm.top:8080/upload/201504/16/201504161149414479.jpg",
                        //   "content":"asdfasdfsadfsadf"
						}
            }
        },
        created(){
            this.id = this.$route.params.id;
            this.getinfo();
        },
        methods:{
            getinfo(){
                  //con 又上面导入的公共组件
                var url =con.base+"/news/newsinfo/"+this.id;
                
                this.$http.get(url).then(function(response){

                    var data = response.body;
                    if(data.status != 0){
                        Toast({message:data.message,duration: 5000})
                        return;
                    }

                    this.info = data.message[0];
                    console.log(this.info)

                },function(response){

                })
            },
        }
    }
</script>

<style scoped>



    .title h4{
        color:#0094ff;
        padding: 10px;
    }

    .title p{
        color:rgba(0, 0, 0, 0.5);
        padding: 10px;
    }

    .content{
        padding: 10px;
    }

</style>

